﻿@model IEnumerable<PeaceBlogData.Tables.Posts>

@{
    ViewBag.Title = "PostList";
    Layout = "~/Views/_PeaceAdminLayout.cshtml";
}

@Html.Partial("AdminPartial/AdminTitle", new PeaceBlog.Models.Types.AdminTitle()
{
     Title = ViewBag.Title,
      FirstLink = Html.ActionLink("Postlar","PostList")
});

<div class="row-fluid">
    <div class="span12">

        <div class="widget">
            <div class="widget-title">
                <h4><i class="icon-reorder"></i>@ViewBag.Title</h4>
                <span class="tools">
                    @Html.ActionLink(String.Format("Tümü ({0})", Model.Count().ToString()), "PostList")
                    @Html.ActionLink(String.Format("Yayınlanmış ({0})", Model.Count(p => !p.IsWork).ToString()), "PostList", new { IsWork = false })
                    @Html.ActionLink(String.Format("Taslak ({0})", Model.Count(p => p.IsWork).ToString()), "PostList", new { IsWork = true })
                </span>
            </div>
            <div class="widget-body">
                <table class="table table-striped table-bordered" id="sample_1">
                    <thead>
                        <tr>
                            <th style="width:8px;">
                                <input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes" />
                            </th>
                            <th>@Html.DisplayNameFor(model => model.Name)</th>
                            <th class="hidden-phone">@Html.DisplayNameFor(model => model.Authors.NameSurname)</th>
                            <th class="hidden-phone">Kategoriler</th>
                            <th class="hidden-phone">Etiketler</th>
                            <th class="hidden-phone">Yorum Sayısı</th>
                            <th class="hidden-phone">SEO Başlık</th>
                            <th class="hidden-phone">SEO Açıklama</th>
                            <th class="hidden-phone">SEO Anahtar Kelimeler</th>
                            <th class="hidden-phone">Tarih</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            <tr class="odd gradeX">
                                <td><input type="checkbox" class="checkboxes" value="@item.PostID" /></td>
                                <td>
                                    @Html.DisplayFor(modelItem => item.Name)
                                </td>
                                <td class="hidden-phone">
                                    @Html.ActionLink(item.Authors.NameSurname, "", new { Id = item.AuthorID })
                                </td>
                                <td class="hidden-phone">
                                    
                                    @foreach (var catItem in item.Categories)
                                    {
                                        @Html.ActionLink(catItem.Name, "", new { Id = catItem.CategoryID })
                                        @Html.Raw(",")
                                    }
                                </td>
                                <td class="hidden-phone">
                                    @foreach (var tagItem in item.Tags)
                                    {
                                        @Html.ActionLink(tagItem.Tag, "", new { Id = tagItem.TagID })
                                        @Html.Raw(",")
                                    }
                                </td>
                                <td class="center hidden-phone">0</td>
                                <td class="hidden-phone">@Html.DisplayFor(modelItem => item.MetaTitle)</td>
                                <td class="hidden-phone">@Html.DisplayFor(modelItem => item.MetaDescription)</td>
                                <td class="hidden-phone">@Html.DisplayFor(modelItem => item.MetaKeywords)</td>
                                <td class="hidden-phone">
                                    @item.SaveDate.ToString("MMMM, dd yyyy")
                                    @if (item.IsWork)
                                    {
                                        @Html.LabelMessage("Taslak", LabelMessageType.Info)
                                    }
                                    else
                                    {
                                        @Html.LabelMessage("Yayınlanmış", LabelMessageType.Success)
                                    }
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
        <!-- END EXAMPLE TABLE widget-->
    </div>
</div>

@section Scripts{
    <script type="text/javascript" src="~/Templates/Admin/assets/uniform/jquery.uniform.min.js"></script>
    <script type="text/javascript" src="~/Templates/Admin/assets/data-tables/jquery.dataTables.js"></script>
    <script type="text/javascript" src="~/Templates/Admin/assets/data-tables/DT_bootstrap.js"></script>
}
